import java.util.Map;

public class Surface extends RenovationObject{

	private double length;
	private double width;
	private Material selectedMaterial;
	
	public Surface(double length, double width){
		this.length = length;
		this.width = width;
	}
	
	public void setMaterial(Material m){
		selectedMaterial = m;
	}
	
	
	public double getArea(){
		return length*width;
	}
	
	public double getLength(){
		return length;
	}
	
	public double getWidth(){
		return width;
	}
	
	
	public double getPrice(){
		return selectedMaterial.getPriceOfASurface(this);
	}
	
	public Map<String, Double> addMaterialReq(Map<String, Double> materials){
		if(selectedMaterial==null)
			return materials;
		String a = selectedMaterial.getName();
		double b = selectedMaterial.getMaterialReq(this);
		if(materials.containsKey(a)){
			b = b+materials.get(a);
		}
		materials.put(a, new Double(b));
		
		return materials;
	}
	
	
}
